<script language="JavaScript" type="text/javascript" src="js/check_basic.js"></script>
<script type="text/javascript">
	 function createQueryString()
	 {
			var id=encodeURI($("#tree1").val());
			//alert(id);
			var querystring={cid:id};
			return 	querystring;
		}
	 function second_cate()
   	 {
	    	$.ajax({
			type:"post",
			url:"second_cate.php",
			data:createQueryString(),
			success:function(data){
				//  alert(decodeURI(data));
				$("#tree2").html(decodeURI(data));			
				}
			});
        }
   
</script>
<div id="comm_cms_head">
		<h2>Edit Book</h2>
		<ul class="shortcut-buttons-set">
			<li>
				<a class="shortcut-button" href="<?php echo site_url('welcome/edit_book'.'/'.$b_id);?>" >
					<img src="images/a-2.png"  />
					<!-- <span style="background:#000">Edit Basic Info</span> -->
				</a>
			</li>
			<li>
				<a class="shortcut-button" href="<?php echo site_url('welcome/upload_book_cover'.'/'.$b_id);?>" >
					<img src="images/b-1.png"  />
					<!--<span>Edit Book Cover</span>-->
				</a>
			</li>
			<li>
				<a class="shortcut-button" href="<?php echo site_url('welcome/upload_plist'.'/'.$b_id);?>" >
					<img src="images/c-1.png"  />
					<!--<span>Edit Book Dir</span>-->
				</a>
			</li>
			<li>
				<a class="shortcut-button" href="<?php echo site_url('welcome/upload_book'.'/'.$b_id);?>" >
					<img src="images/d-1.png"  />
					<!--<span>Edit Book Content</span>-->
				</a>
			</li>
		</ul>
	</div>
	<div id="comm_cms_center" style="border:1px solid #fff">

<span style="clear:both; display:block; height:5px;"></span>

<form action="<?php echo site_url('welcome/update_book_basic'.'/'.$b_id)?>" name="step_one" method="post" enctype="multipart/form-data">
	<table>
		<tr><td>App Store Id:</td><td><input type="text" name="prod_id" id="prod_id" value="<?php echo $msg['pid']?>" /></td></tr>
		<tr><td>ISBN:</td><td ><input type="text" name="isbn" id="isbn" value="<?php echo $msg['isbn']?>" /></td></tr>
		<tr><td>Book Name:</td><td ><input type="text" name="name" id="name" value="<?php echo $msg['bn']?>" /></td></tr>
		<tr><td>Author:</td><td ><input type="text" name="author" id="author" value="<?php echo $msg['au']?>"/></td></tr>
		<tr><td>Publisher:</td><td ><input type="text" name="publisher" id="publisher" value="<?php echo $msg['pn']?>"/></td></tr>
		<tr><td>Price:</td><td ><input type="text" name="price" id="price" value="<?php echo $msg['pc']?>"/></td></tr>
		<tr><td>Publish Time:</td><td ><input type="text" name="ptime" id="ptime" value="<?php echo $msg['pd']?>"/></td></tr>
		<tr><td>Book Description:</td><td ><textarea name="describe" rows="15" cols="90" ><?php echo $msg['bd']?></textarea></td></tr>
		<tr>
			<td>Select Category:</td>
			<td >
			<select name="tree1" id="tree1" onchange="return second_cate()" style="width:200px;">
				<option value=''>Select First Categoty</option>
				<?php 
				   	foreach ($cate as $val)
				    {
						if(isset($slave))
						{
					    	if($val['classify_id']==$slave[0]['type_id'])
							{
								 echo "<option selected=\"selected\" value=\"".$val['classify_id']."\" />".$val['type']."</option>";
							}
							else 
							{
								 echo "<option  value=\"".$val['classify_id']."\" />".$val['type']."</option>";
							}
						}
						else 
						{
							echo "<option  value=\"".$val['classify_id']."\" />".$val['type']."</option>";
						}
				    }
			    ?>
				
			</select>
			<select name="tree2[]" id="tree2" multiple="multiple" style="width:200px;">
				<?php 
				if(isset($se_cate)&&isset($slave))
				{
					foreach ($se_cate as $se)
					{
						$p=0;
						foreach ($slave as $select) 
						{
							if($select['type_id']==$se['classify_id'])
							{
								$p=1;
							}
						}
						if($p==1)
						{
							echo "<option selected=\"selected\" value=\"".$se['classify_id']."\" />".$se['type']."</option>";
						}
						elseif($p==0)
						{
							echo "<option value=\"".$se['classify_id']."\" />".$se['type']."</option>";
						}
					}
				}	
				?>
			</select>
			</td>
		</tr>
		<tr>
		<td>Star:</td>
		<td >
			<?php 
			$radio=array(
				array('val'=>'1','show'=>'One'),
				array('val'=>'2','show'=>'Two'),
				array('val'=>'3','show'=>'Three'),
				array('val'=>'4','show'=>'Four'),
				array('val'=>'5','show'=>'Five'),
			);
			foreach($radio as $radio_msg)
			{
				if($radio_msg['val']==$msg['star'])
				{
					echo "<input checked=\"checked\" type=\"radio\" name=\"star\" value=\"".$radio_msg['val']."\"/>".$radio_msg['show'];
				}
				else 
				{
					echo "<input type=\"radio\" name=\"star\" value=\"".$radio_msg['val']."\"/>".$radio_msg['show'];			
				}
				
			}
			
			?>
		</td>
		</tr>
		<tr><td><input type="submit" name="submit" id="submit" class="button" value="submit"/></td><td ><input type="reset" name="reset" id="reset" class="button" value="reset"/></td></tr>	
	</table>

</form>
